package com.hmall.item.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hmall.item.mapper.ItemMapper;
import com.hmall.item.pojo.Item;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ItemService extends ServiceImpl<ItemMapper, Item> implements com.hmall.item.service.ItemService {

    @Autowired
    private ItemMapper itemMapper;

    /**
     * 商品上架与下架
     * @param id
     * @param status
     */
    @Override
    public void shelvesAndTakedown(Integer id, Integer status) {
        Item item = itemMapper.selectById(id);
        item.setStatus(status);
        itemMapper.updateById(item);
    }

    /**
     * 商品更新
     * @param item
     */
    @Override
    public void updateTheProduct(Item item) {
        itemMapper.updateById(item);
    }
}
